home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_aet_armmove.cog < prev    next >
Text File  |  1999-11-15  |  16KB  |  654 lines

  1. # Jones 3D Cog Script
  2. #
  3. # aet_ArmMove.cog
  4. #
  5. # [TL & revised by HB] [Whip by RT :)]
  6. #
  7. # (C) 1999 LucasArts Entertainment Co. All Rights Reserved
  8. #
  9. # ==============================================================================
  10.  
  11. symbols
  12.  
  13. message        startup
  14. #### message        entered #### REMOVE BEFORE FLIGHT ####
  15. message        arrived
  16. message        damaged
  17. message        callback
  18.  
  19.  
  20. keyframe     in_whipit=in_whip_outprobe.key    local
  21. keyframe    wh_whipit=wh_whip_outprobe.key     local
  22.  
  23. keyframe    in_handsONhips=0in_stand4.key    local
  24. keyframe    in_handsTOhips=0in_stand1_bd_4.key           local
  25.  
  26.  
  27. model        whipHand=weap_whip.3do            local
  28.  
  29. sound        charge=aet_mr_chargeup.wav        local
  30. sound        success_cue=mus_shs_womanappears.wav    local
  31. sound        cagestart=gen_cage_descend.wav            local        # Start of cage drop.
  32. sound        whip=gen_whip_fire.wav            local
  33. sound        roll=gen_whip_ravel.wav            local
  34.  
  35. thing        player                            local
  36. thing        arm0                                    # Large bridge/arms
  37. thing        gear0                                    # Gear attached to arms
  38. thing        arm1
  39. thing        gear1
  40. thing        arm2
  41. thing        gear2
  42. thing        probe0                                    # Probe that is whipped to retract bridge                            
  43. thing        probe1                                                      
  44. thing        probe2                          
  45. thing        probeA                                    # Probe that is cross faded to show charge                        
  46. thing        probeB                          
  47. thing        probeC                          
  48.  
  49. thing        cage                                    # Sophia's cage
  50. thing        indy0                                    # Indy actor 1
  51. thing        indy1                                    # Indy actor 2
  52. thing        indy2                                    # Indy actor 3
  53.  
  54. thing        cam0                                    # Camera 1
  55. thing        cam1                                    # Camera 2
  56. thing        cam2                                    # Camera 3
  57. thing        cam0_target                                # Camera 1 target
  58. thing        cam1_target                                # Camera 2 target
  59. thing        cam2_target                                # Camera 3 target
  60. thing        tel_target0                                # Player teleport spot 1
  61. thing        tel_target1                                # Player teleport spot 1
  62. thing        tel_target2                                # Player teleport spot 1
  63.             
  64. thing        secondary_target
  65.  
  66. thing        cg_mk_1                                    # Cage target
  67. thing        indy1_mk_1                        nolink    # Mark for Indy2 to watch cage
  68. thing        in_mk_final                        nolink    # where player ends up
  69.  
  70. thing        whipThing                        local
  71.  
  72. thing        indyvar                            local    # indy actor var
  73. thing        armvar                            local    # bridge arm var
  74. thing        camvar                            local    # camera var
  75. thing        targetvar                        local    # cam target var
  76. thing        armspotvar                        local    # bridge mark var
  77. thing        darkprobevar                    local    # unlit
  78. thing        litprobevar                        local    # lit
  79. thing        spritespotvar                    local
  80. thing        spritespot0
  81. thing        spritespot1
  82. thing        spritespot2
  83.  
  84. thing        spritepulse0a
  85. thing        spritepulse0b
  86. thing        spritepulse0c
  87. thing        spritepulse1a
  88. thing        spritepulse1b
  89. thing        spritepulse1c
  90. thing        spritepulse2a
  91. thing        spritepulse2b
  92. thing        spritepulse2c
  93.  
  94. thing        sender                            local
  95.  
  96. cog            cagecog                                    # aet_RotateCage.cog (Mophia intro)
  97. cog            miniSophCut                                # aet_MiniSophCut.cog (Mini Soph Cutscene)
  98. cog            doortalk
  99. cog            marduk2                                    # Cog that controls second Marduk...
  100. cog            door2                                    # Cog that controls the door that closes behind player.
  101.  
  102. template    whipTpl=+whip_actor                local
  103. template    sparks0=mophiaSparksLg            local
  104. template    chargesprite=+tower_glow        local
  105.  
  106. vector        v_camspot                        local
  107.  
  108. flex        indy1move                        local    # Handler for calling Indy1 to move
  109. flex        wrongwhip                        local
  110. flex        tryagain                        local
  111.  
  112. int            done0=0                            local    # Flag for when an arm is done retracting
  113. int            done1=0                            local
  114. int            done2=0                            local
  115. int            curcam                            local    # camera *before* cutscene begins
  116.  
  117. int            curSound                        local
  118. int            indyAnim                        local
  119. int            whipAnim                        local
  120. int            whip_done0=0                    local
  121. int            whip_done1=0                    local
  122. int            whip_done2=0                    local
  123. int            in_keytrack1                    local
  124. int            lastarm=0                        local
  125. int            silverwhip=0                    local
  126. int            sprite0                            local
  127.  
  128. int            callNum                            local
  129. int            damageType                        local
  130.  
  131. #### REMOVE BEFORE FLIGHT!
  132.  
  133. int            whicharm=0                        local
  134. int            didarm0=0                        local
  135. int            didarm1=0                        local
  136. int            didarm2=0                        local
  137. int            whipactive=0                    local
  138.  
  139. ####
  140.  
  141. end
  142.  
  143. # ==============================================================================
  144.  
  145. code
  146.  
  147. # ..............................................................................
  148.  
  149. startup:
  150.  
  151.     player = GetLocalPlayerThing();
  152.     AttachThingToThing(gear0, arm0);
  153.     AttachThingToThing(gear1, arm1);
  154.     AttachThingToThing(gear2, arm2);
  155.  
  156.     SetThingLight(arm0, '0.3 0.3 0.3', 0.01, 0.1);
  157.     SetThingLight(arm1, '0.3 0.3 0.3', 0.01, 0.1);
  158.     SetThingLight(arm2, '0.3 0.3 0.3', 0.01, 0.1);
  159.     SetThingLight(gear0, '0.3 0.3 0.3', 0.01, 0.1);
  160.     SetThingLight(gear1, '0.3 0.3 0.3', 0.01, 0.1);
  161.     SetThingLight(gear2, '0.3 0.3 0.3', 0.01, 0.1);
  162.  
  163.     AttachThingToThingEx(indy1_mk_1, arm1, 0x0C); # Attach Indy1 mark to arm1.      
  164.     AttachThingToThingEx(spritepulse0a, arm0, 0x0C);       
  165.     AttachThingToThingEx(spritepulse0b, arm0, 0x0C);       
  166.     AttachThingToThingEx(spritepulse0c, arm0, 0x0C);       
  167.     AttachThingToThingEx(spritepulse1a, arm1, 0x0C);       
  168.     AttachThingToThingEx(spritepulse1b, arm1, 0x0C);       
  169.     AttachThingToThingEx(spritepulse1c, arm1, 0x0C);       
  170.     AttachThingToThingEx(spritepulse2a, arm2, 0x0C);       
  171.     AttachThingToThingEx(spritepulse2b, arm2, 0x0C);       
  172.     AttachThingToThingEx(spritepulse2c, arm2, 0x0C);       
  173.  
  174.     # Fade charged probe out.
  175.     SetThingAlpha(probeA, 0.0);
  176.     SetCollideType(probeA, 0);
  177.     SetThingAlpha(probeB, 0.0);
  178.     SetCollideType(probeB, 0);
  179.     SetThingAlpha(probeC, 0.0);
  180.     SetCollideType(probeC, 0);
  181.  
  182.     return;
  183.  
  184. # ..............................................................................
  185.  
  186. #### REMOVE BEFORE FLIGHT!
  187. #### entered: 
  188.  
  189.     //sender = GetSenderRef();
  190.  
  191.     //if ((sender == arm0) && (didarm0 == 0))
  192.     //{
  193.     //    whicharm = 0;
  194.     //    didarm0 = 1;
  195.     //    goto damaged;
  196.     //}
  197.  
  198.     //if ((sender == arm1) && (didarm1 == 0))
  199.     //{
  200.     //    whicharm = 1;
  201.     //    didarm1 = 1;
  202.     //    goto damaged;
  203.     //}
  204.  
  205.     //if ((sender == arm2) && (didarm2 == 0))
  206.     //{
  207.     //    whicharm = 2;
  208.     //    didarm2 = 1;
  209.     //    goto damaged;
  210.     //}
  211.  
  212.     //return;
  213. ####
  214.  
  215. # ..............................................................................
  216.  
  217. damaged:
  218.  
  219.     sender = GetSenderRef();
  220.  
  221.     if ((sender != probe0) && (sender != probe1) && (sender != probe2))
  222.     #### if ((sender != arm0) && (sender != arm1) && (sender != arm2))
  223.     {
  224.         return;
  225.     }
  226.  
  227.     if (whipactive != 0)
  228.     {
  229.         return;
  230.     }
  231.  
  232.     whipactive = 1;
  233.     silverwhip = 0;
  234.  
  235.     damageType = GetParam(1);
  236.     if ((damageType != 0x10) && (damageType != 0x800))
  237.         return;
  238.  
  239.     if ((damageType == 0x800) || (global6 == 1)) # RT: Global6 means you've charged whip at least once
  240.     {
  241.         if (sender == probe2)
  242.         {
  243.             # Indy whips this probe 1st...
  244.     
  245.             # Destroy plate for miniSophCut...
  246.             SendMessage(miniSophCut, user2);        
  247.             # Send a message to Steve's Marduk 2 cog.
  248.             SendMessageEx(marduk2, user0, 1, 0, 0, 0);
  249.             indyvar = indy2;
  250.             armvar = arm2;    
  251.             camvar = cam2;
  252.             targetvar = cam2_target;
  253.             darkprobevar = probe2;
  254.             litprobevar = probeC;
  255.             spritespotvar = spritespot2;
  256.             silverwhip = 1;
  257.         }
  258.         else if (sender == probe0)
  259.         {
  260.             # Indy whips this probe 2nd...
  261.             SendMessage(miniSophCut, user0);
  262.             # Send a message to Steve's Marduk 2 cog.
  263.             SendMessageEx(marduk2, user0, 2, 0, 0, 0);
  264.             indyvar = indy0;
  265.             armvar = arm0;
  266.             camvar = cam0;
  267.             targetvar = cam0_target;
  268.             darkprobevar = probe0;
  269.             litprobevar = probeA;
  270.             spritespotvar = spritespot0;
  271.             silverwhip = 1;
  272.         }
  273.         else if (sender == probe1)
  274.         {
  275.             # Indy whips this probe 3rd...
  276.             SendMessage(miniSophCut, user1);
  277.     
  278.             # Send a message to Steve's Marduk 2 cog.
  279.             SendMessageEx(marduk2, user0, 3, 0, 0, 0);
  280.             indyvar = indy1;
  281.             armvar = arm1;    
  282.             camvar = cam1;
  283.             targetvar = cam1_target;
  284.             darkprobevar = probe1;
  285.             litprobevar = probeB;
  286.             spritespotvar = spritespot1;
  287.             silverwhip = 1;
  288.     
  289.             # Play music...
  290.             PlaySoundLocal(success_cue, 1.0, 0, 0x0, 0);
  291.         }
  292.     }
  293.  
  294.     if (silverwhip != 0)
  295.     {
  296.         # Prep...
  297.         curcam = GetCurrentCamera();
  298.         ResetCameraFOV(0, 0.0);
  299.         MakeMeStop();
  300.         SetCameraLookInterp(2, 0);
  301.         SetCameraPosInterp(2, 0);
  302.  
  303.         SetCurrentCamera(2);
  304.         SetCameraFocus(2, camvar);
  305.         SetCameraSecondaryFocus(2, targetvar);
  306.         SetCameraFOV(60, 0, 0);
  307.         Sleep(0.01);
  308.         SetCameraFOV(50, 1, 3.5);
  309.  
  310.         # Prep indy... 
  311.         CopyPlayerHolsters(player, indyvar);
  312.         ClearThingFlags(indyvar, 0x80000);
  313.         SetThingFlags(player, 0x80000);
  314.  
  315.         StartCutScene(1);
  316.  
  317.         # Prep whip...
  318.         whipThing = AttachThingToThingMesh(indyvar, whipTpl, 15);
  319.         SetThingMesh(indyvar, 15, whipHand, 0);
  320.  
  321.         # Do that whip swing thang...
  322.         indyAnim = PlayKey(indyvar, in_whipit, 5, 0x14, 0); # Indy anim...
  323.         CaptureThing(whipThing); # Make sure we get the callback message...
  324.         whipAnim = PlayKey(whipThing, wh_whipit, 5, 0x14, 0); # Whip anim...
  325.         
  326.         Sleep(1.5);
  327.  
  328.         if (damageType == 0x10)
  329.         {
  330.             SetWhipElectric(1);
  331.             ChangeInv(player, 2, 4); # Add 4 shots to the whip bin...already has 1.
  332.         }
  333.         else
  334.         {
  335.             ChangeInv(player, 2, -1.0); # Decrease bin by 1...
  336.         }
  337.  
  338.         PlaySoundLocal(charge, 1, 0, 0x0, 0);
  339.  
  340.         CreateThing(sparks0, litprobevar);
  341.         CreateThing(sparks0, litprobevar);
  342.         sprite0 = CreateThing(chargesprite, spritespotvar);
  343.         
  344.         AnimateSpriteSize(sprite0, '0.25 0.25 1.0', '0.35 0.35 0.0', 1.0);
  345.         
  346.         ThingFadeAnim(darkprobevar, 1.0, 0.0, 2.0, 0);
  347.         ThingFadeAnim(litprobevar, 0.0, 1.0, 2.0, 0);
  348.     }
  349.     else
  350.     {
  351.         # Code for whipping probe without electric whip...
  352.         if ((GetParam(1) == 0x10) && (sender == probe0))
  353.         {
  354.             if (whip_done0 == 1) return;
  355.             whip_done0 = 1;
  356.             indyvar = indy0;
  357.             camvar = cam0;
  358.             targetvar = cam0_target;
  359.         }
  360.  
  361.         if ((GetParam(1) == 0x10) && (sender == probe1))
  362.         {
  363.             if (whip_done1 == 1) return;
  364.             whip_done1 = 1;
  365.             indyvar = indy1;
  366.             camvar = cam1;
  367.             targetvar = cam1_target;
  368.         }
  369.  
  370.         if ((GetParam(1) == 0x10) && (sender == probe2))
  371.         {
  372.             if (whip_done2 == 1) return;
  373.             whip_done2 = 1;
  374.             indyvar = indy2;
  375.             camvar = cam2;
  376.             targetvar = cam2_target;
  377.         }
  378.  
  379.         SetActorFlags(player, 0x200000);
  380.         
  381.         # Prep...
  382.         curcam = GetCurrentCamera();
  383.         ResetCameraFOV(0, 0.0);
  384.         MakeMeStop();
  385.  
  386.         # Cut to power ball...
  387.         SetCameraFocus(2, camvar);
  388.         SetCameraSecondaryFocus(2, targetvar);
  389.         SetCameraLookInterp(2, 0);
  390.         Sleep(0.01);
  391.         SetCurrentCamera(2);
  392.         SetCameraFOV(100, 0, 0);
  393.         Sleep(0.01);
  394.         SetCameraFOV(90, 1, 2.0);
  395.  
  396.         # Prep indy...
  397.         CopyPlayerHolsters(player, indyvar); # Make sure actor has matching props.
  398.         ClearThingFlags(indyvar, 0x80000);
  399.         SetThingFlags(player, 0x80000); 
  400.  
  401.         StartCutScene(1);
  402.  
  403.         # Prep whip...
  404.         whipThing = AttachThingToThingMesh(indyvar, whipTpl, 15);
  405.         SetThingMesh(indyvar, 15, whipHand, 0);
  406.  
  407.         # Do the whip swing fake animation...
  408.         indyAnim = PlayKey(indyvar, in_whipit, 5, 0x14, 0); # Indy anim...
  409.         CaptureThing(whipThing); # Make sure we get the callback message...
  410.         whipAnim = PlayKey(whipThing, wh_whipit, 5, 0x14, 0); # Whip anim...
  411.         
  412.         Sleep(1.5);
  413.  
  414.         PlaySoundLocal(whip, 1.0, 0.0, 0x0, 0);
  415.         
  416.         # Wait for action...
  417.         Sleep(2.5);
  418.     }
  419.  
  420.     return;
  421.  
  422. # ..............................................................................
  423.  
  424. callback:
  425.  
  426.     sender = GetSenderRef();
  427.     callNum = GetParam(1);
  428.  
  429.     if (sender == indyvar)
  430.     {
  431.         if (callNum != 24) return;
  432.             
  433.         # Stop animations...
  434.         StopKey(indyvar, indyAnim, 0);
  435.         StopKey(whipThing, whipAnim, 0);
  436.  
  437.         DetachThingMesh(whipThing);
  438.         SetWeaponModel(indyvar, 2);
  439.  
  440.         if (silverwhip) # Electric whip
  441.         {
  442.             if (GetInv(player, 2) < 1) # Turn it off if it's outta juice...
  443.             {
  444.                 SetWhipElectric(0);
  445.  
  446.                 SetInv(player, 2, 1.0); # Reset the bin to 1...
  447.                 SetInvAvailable(player, 2, 1);
  448.  
  449.                 silverwhip = 0;
  450.             }
  451.         }
  452.  
  453.         # If callback is from regular whip...
  454.         if (whip_done0 == 1)
  455.         {
  456.             call wrongwhip;
  457.             whip_done0 = 0;
  458.             return;
  459.         }
  460.         if (whip_done1 == 1)
  461.         {
  462.             call wrongwhip;
  463.             whip_done1 = 0;
  464.             return;
  465.         }
  466.         if (whip_done2 == 1)
  467.         {
  468.             call wrongwhip;
  469.             whip_done2 = 0;
  470.             return;
  471.         }
  472.  
  473.         # Cue music...
  474.         //PlaySoundLocal(success_cue, 1.0, 0, 0x0, 1);
  475.         
  476.         MoveToFrame(armvar, 1, 1.0);
  477.  
  478.         # Start Indy1 moving...
  479.         if (indyvar == indy1)
  480.         {
  481.             Sleep(0.1);    
  482.             call indy1move;
  483.         }
  484.         else
  485.         {
  486.             AISetLookThingEyeLevel(indyvar, cage);
  487.         }
  488.     }
  489.  
  490.     return;
  491.  
  492. # ..............................................................................
  493.  
  494. arrived:
  495.  
  496.     sender = GetSenderRef();
  497.     
  498.     if ((sender != arm0) && (sender != arm1) && (sender != arm2))
  499.     {
  500.         return;
  501.     }
  502.     
  503.     if (sender == arm1)
  504.     {
  505.         # When this arm--always last!--retracts, drop Sophia's cage to dais
  506.         # and start the Marduk/Sophia merger cutscene...
  507.         
  508.         lastarm = 1;
  509.         
  510.         # Turn on interp code...
  511.         SetCameraInterpSpeed(2, 2.0);
  512.         SetCameraLookInterp(2, 1);
  513.         SetCameraPosInterp(2, 1);
  514.         Sleep(0.01);
  515.         
  516.         # Pan over to cage as it goes down and zoom...
  517.         SetCameraSecondaryFocus(2, secondary_target);
  518.         SetCameraFOV(30, 1, 2.0);
  519.         Sleep(2.0);
  520.  
  521.         PlaySoundLocal(cagestart, 1, 0, 0x0, 0);    
  522.         
  523.         AISetMoveSpeed(cage, 1.0);
  524.         AISetMoveThing(cage, cg_mk_1, 0);
  525.  
  526.         # Sleep before sending message to cutscene cog...
  527.         Sleep(2.0);
  528.         
  529.         # Prep for return to play...
  530.         StopKey(indy1, in_keytrack1, 0.0);
  531.         TeleportThing(indy1, in_mk_final);
  532.         TeleportThing(player, in_mk_final); 
  533.         
  534.         # End cutscene (formality only:  next scene plays immediately!)...
  535.         SetThingFlags(indy1, 0x80000);
  536.         ClearThingFlags(player, 0x80000);
  537.         
  538.         # TRIGGER MERGE CUTSCENE RIGHT HERE...
  539.         SendMessage(cagecog, user0); 
  540.         
  541.         return;
  542.     }
  543.  
  544.     if (sender == arm0)
  545.     {
  546.         armspotvar = tel_target0;
  547.         indyvar = indy0;
  548.         lastarm = 0;
  549.     }
  550.  
  551.     if (sender == arm2)
  552.     {
  553.         global11 = 0;
  554.         SendMessage(door2, user0);
  555.  
  556. tryagain:
  557.  
  558.         Sleep(0.01);
  559.         if (global11 == 0)
  560.         {
  561.             #Wait for small cutscene to finish...
  562.             //Sleep(0.01);
  563.             goto tryagain;
  564.         }
  565.         armspotvar = tel_target2;
  566.         indyvar = indy2;
  567.         lastarm = 0;
  568.     }
  569.  
  570.     if (lastarm == 0)
  571.     {
  572.         # Return to play...
  573.         TeleportThing(player, armspotvar);
  574.  
  575.         v_camspot = VectorAdd(VectorTransformToOrient(player, '0.2 -0.02 0.05'), GetThingPos(player));    
  576.         SetCameraPosition(1, v_camspot);
  577.  
  578.         SetCurrentCamera(1);
  579.         ResetCameraFOV(0, 0.0);
  580.         SetThingFlags(indyvar, 0x80000);
  581.         ClearThingFlags(player, 0x80000);
  582.         
  583.         EndCutScene();
  584.         ClearActorFlags(player, 0x200000);
  585.         whipactive = 0;
  586.  
  587.         Sleep(1.0);
  588.         # Play music...
  589.         PlaySoundLocal(success_cue, 1.0, 0, 0x0, 0);
  590.     }
  591.  
  592.     return;
  593.  
  594. # ..............................................................................
  595.  
  596. indy1move:
  597.  
  598.     # Move Actor Indy1 to mark1...
  599.     AISetCutSceneMode(indy1);
  600.     AISetMoveSpeed(indy1, 1.0);
  601.     AISetLookThing(indy1, indy1_mk_1);
  602.     AIWaitForStop(indy1);
  603.     TeleportThing(player, indy1);
  604.     SetThingFlags(indy1, 0x80000);
  605.     ClearThingFlags(player, 0x80000);
  606.     DeselectWeaponWait(player);
  607.     CopyPlayerHolsters(player, indy1);
  608.     SetThingFlags(player, 0x80000);
  609.     CLearThingFlags(indy1, 0x80000);
  610.     AISetMoveThing(indy1, indy1_mk_1, 0);
  611.  
  612.     Sleep(4.0);
  613.     StopThing(indy1);
  614.     in_keytrack1 = PlayKey(indy1, in_handsONhips, 2, 0x10, 0);
  615.     PlayKey(indy1, in_handsTOhips, 4, 0x12, 0);
  616.  
  617.     return;
  618.  
  619. # ..............................................................................
  620.  
  621. wrongwhip:
  622.  
  623.     # When wrong whip is used...
  624.  
  625.     global15 = 0;
  626.     ## SendMessageEx(doortalk, user3, indyvar, 0, 0, 0);
  627.     ## while (global15 == 0)
  628.     ## {
  629.         # Wait for line to finish...
  630.     ##    Sleep(0.01);
  631.     ## }
  632.  
  633.     # Back to play...
  634.     TeleportThing(player, indyvar);
  635.  
  636.     v_camspot = VectorAdd(VectorTransformToOrient(player, '0.2 -0.02 0.05'), GetThingPos(player));    
  637.     SetCameraPosition(1, v_camspot);
  638.  
  639.     SetCurrentCamera(1);
  640.     ResetCameraFOV(0, 0.0);
  641.     SetThingFlags(indyvar, 0x80000);
  642.     ClearThingFlags(player, 0x80000);
  643.  
  644.     done1 = 0;
  645.  
  646.     EndCutScene();
  647.     ClearActorFlags(player, 0x200000);
  648.     whipactive = 0;
  649.  
  650.     return;
  651.  
  652. end
  653.  
  654.